export function	build(query,path,domain) {
	let str = '';
	if(query&&(typeof query == 'object')){
		for(let key in query){
			let value = encodeURI(query[key]||'');
			str += `&${key}=${value}`;
		}
	}
	let dp = (domain||'') + (path||'');
	if(typeof dp == 'string' && /^http(s?)/.test(dp) ){
		if(dp.indexOf('?')>-1){
			str = dp + str;
		}else{
			str = dp + '?' + str;
		}
	}
	// #ifdef H5
		str = str.replaceAll('$CurrentURL',encodeURIComponent(location.href));
	// #endif
	return str;
}
export function only(url,key){
	let params = all(url);
	return (key in params)?params[key]:'';
}
export function all(url) {
	if(typeof url !== 'string'){
		return {};
	}
	return url.substring(url.indexOf('?')+1).split("&").reduce(function(joinObj, item){
		item = item.split('=');
		if((item instanceof Array)&&item.length===2){
			let hashIndex = item[1].indexOf('#');
			item[1] = decodeURI(item[1]);
			if(hashIndex>-1){
				item[1] = item[1].substring(0,hashIndex)
			};
			return {...joinObj,[item[0]]:item[1]}
		}else{
			return {...joinObj}
		}
	},{})
}